package entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.validation.constraints.Pattern;
import java.io.Serializable;

@JsonIgnoreProperties({"age","phone"})
public class Emp implements Serializable {
    private Integer id;

    @JsonProperty("username")
    @NotBlank(message = "姓名不能为空")
    private String name;

    @JsonIgnore
    @Length(min = 3,max = 7)
    private String password;

    @Email
    private String email;

    @Range(min = 1,max = 120,message = "非人类")
    private Integer age;

    @Pattern(regexp = "^\\d{3,4}-\\d{8}$")
    private String phone;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Emp() {
    }
}
